var app = getApp();
var jsondata = require('Wpilot_robotskill_data.js')
Page({
  /**
   * 页面的初始数据
   */
  data: {
    listname: -1,
    skillData: []
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this;
    wx.showToast({
      title: '加载中',
      icon: 'loading',
      duration: 10000
    })
    var weaponDamagearr = [];
    var durabilityearr = [];
    var repairarr = [];
    var resistancearr = [];
    var speedarr = [];
    var modulearr = [];
    var miscellaneousarr = [];
    var tradeOffarr = [];
    var abilityBasedarr = [];
    var abilityRechargearr = [];
    var abilityTradeOffarr = [];

    for (var i in jsondata) {
      var data = jsondata[i]
      if (data.type == "1") {
        weaponDamagearr.push(data)
      }
      if (data.type == "2") {
        durabilityearr.push(data)
      }
      if (data.type == "3") {
        repairarr.push(data)
      }
      if (data.type == "4") {
        resistancearr.push(data)
      }
      if (data.type == "5") {
        speedarr.push(data)
      }
      if (data.type == "6") {
        modulearr.push(data)
      }
      if (data.type == "7") {
        miscellaneousarr.push(data)
      }
      if (data.type == "8") {
        tradeOffarr.push(data)
      }
      if (data.type == "9") {
        abilityBasedarr.push(data)
      }
      if (data.type == "10") {
        abilityRechargearr.push(data)
      }
      if (data.type == "11") {
        abilityTradeOffarr.push(data)
      }
    }
    var weaponobj = {
      title: "提升武器伤害",
      value: weaponDamagearr
    }
    var durabilityeobj = {
      title: "提升耐久性",
      value: durabilityearr
    }
    var repairobj = {
      title: "恢复技能",
      value: repairarr
    }
    var resistanceobj = {
      title: "抗性技能",
      value: resistancearr
    }
    var speedobj = {
      title: "速度技能",
      value: speedarr
    }
    var moduleobj = {
      title: "模块技能",
      value: modulearr
    }
    var miscellaneousobj = {
      title: "锁定技能",
      value: miscellaneousarr
    }
    var tradeOffobj = {
      title: "权衡技能(特殊)",
      value: tradeOffarr
    }
    var abilityBasedobj = {
      title: "基础技能(特殊)",
      value: abilityBasedarr
    }
    var abilityRechargeobj = {
      title: "充能技能(特殊)",
      value: abilityRechargearr
    }
    var abilityTradeOffobj = {
      title: "权衡技能(特殊)",
      value: abilityTradeOffarr
    }
    var corearr = [weaponobj, durabilityeobj, repairobj, resistanceobj, speedobj, moduleobj, miscellaneousobj,tradeOffobj,abilityBasedobj,abilityRechargeobj,abilityTradeOffobj]

    this.setData({
      skillData: corearr
    })
    wx.hideToast();
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
  },

  listactive: function (e) {
    this.setData({ listname: e.currentTarget.dataset.listname })
  },

})